// 引入接口地址
import { menuList } from "../../../request/api"
// 菜单仓库模块
const state = {
    menuList: []
}

const mutations = {
    REQ_MENULIST(state, payload) {
        return state.menuList = payload
    }
}

const actions = {
    menuList_Action({ commit }) {
        // 调用菜单列表接口
        menuList({ istree: true }).then(res => {
            console.log(res);
            if (res.code == 200) {
                commit("REQ_MENULIST", res.list)
            }
        })
    }
}

const getters = {
    // 获取菜单列表
    getMenuList(state) {
        return state.menuList;
    }
}

// 导出菜单仓库
export default {
    state,
    mutations,
    actions,
    getters,
    namespaced: true
}